﻿using BBI.Model;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace BBI.Data
{
    public class CategoryConfiguration : EntityTypeConfiguration<Category>
    {
        public CategoryConfiguration()
        {
            this.HasKey(b => b.CategoryId);
            this.Property(b => b.CategoryId)
                .HasColumnName("CategoryId")
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            this.ToTable("art_Categories");

            this.Property(p => p.Title).HasMaxLength(50).IsRequired();
            this.Property(p => p.Importance).IsRequired();
            this.Property(p => p.Active).IsRequired();
            this.Property(p => p.AddedDate).IsRequired().HasColumnType("datetime");
            this.Property(p => p.AddedBy).HasMaxLength(50);
           
        }
    }
}
